<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="jakarta.tags.core" %>
<%-- 获取当前请求路径 --%>
<% 
String currentPath = request.getRequestURI(); 
pageContext.setAttribute("currentPath", currentPath);
%>
<!-- 侧边栏 -->
<div class="sidebar">
  <div class="sidebar-header">
    <i class="fas fa-hospital fa-2x"></i>
    <h2><a href="toWorkspace" style="color: white">医疗预约系统</a></h2>
  </div>

  <div class="sidebar-menu">
    <!-- 患者用户(type=1)只显示指定的菜单项 -->
    <c:if test="${sessionScope.loginAdmin.type ne 1 and sessionScope.loginAdmin.type ne 2}">
      <a href="toWorkspace" class="menu-item ${currentPath.contains('toWorkspace') ? 'active' : ''}">
        <i class="fas fa-tachometer-alt"></i>
        <span>控制面板</span>
      </a >
      <a href="hospital/find" class="menu-item ${currentPath.contains('hospital/find') ? 'active' : ''}">
        <i class="fas fa-building"></i>
        <span>医院管理</span>
      </a >
      <a href="department/find" class="menu-item ${currentPath.contains('department/find') ? 'active' : ''}">
        <i class="fas fa-clinic-medical"></i>
        <span>科室管理</span>
      </a >
      <a href="doctor/find" class="menu-item ${currentPath.contains('doctor/find') ? 'active' : ''}">
        <i class="fas fa-user-md"></i>
        <span>医生管理</span>
      </a >
    </c:if>
    
    <!-- 医生和管理员都显示预约排班管理 -->
    <c:if test="${sessionScope.loginAdmin.type eq 2 or sessionScope.loginAdmin.type eq 3}">
      <a href="visit/find" class="menu-item ${currentPath.contains('visit/find') ? 'active' : ''}">
        <i class="fas fa-calendar-alt"></i>
        <span>预约排班管理</span>
      </a >
    </c:if>
    
    <!-- 预约记录管理：所有用户都显示 -->
    <a href="appointment/find" class="menu-item ${currentPath.contains('appointment/find') ? 'active' : ''}">
      <i class="fas fa-calendar-check"></i>
      <span>预约记录管理</span>
    </a >
    
    <!-- 支付记录：只有非医生用户显示 -->
    <c:if test="${sessionScope.loginAdmin.type ne 2}">
      <a href="pay/find" class="menu-item ${currentPath.contains('pay/find') ? 'active' : ''}">
        <i class="fas fa-credit-card"></i>
        <span>支付记录</span>
      </a >
    </c:if>
    
    <!-- 病单报告：所有用户都显示 -->
    <a href="report/find" class="menu-item ${currentPath.contains('report/find') ? 'active' : ''}">
      <i class="fas fa-file-medical-alt"></i>
      <span>病单报告</span>
    </a >
    
    <!-- 个人信息：所有用户都显示 -->
    <a href="user/profile" class="menu-item ${currentPath.contains('user/profile') ? 'active' : ''}">
      <i class="fas fa-user-circle"></i>
      <span>个人信息</span>
    </a >
  </div>
</div>